home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / emstools.arc / EMMLIB.ARC / EMM15_B.ASM < prev    next >
Assembly Source File  |  1990-02-04  |  4KB  |  87 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM15_B.ASM                                             ;
  3. ;                                                                             ;
  4. ;    FUNCTION NAME:   set_context                                             ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function restores the mapping context for all      ;
  7. ;                     mappable memory regions (conventional and expanded).    ;
  8. ;                     The function copies the contents of a source structure  ;
  9. ;                     into the mapping hardware on each expanded memory board ;
  10. ;                     in the system.  The application must pass a pointer to  ;
  11. ;                     the source structure.  set_context doesn't require an   ;
  12. ;                     EMM handle.                                             ;
  13. ;                                                                             ;
  14. ;                     Use this function instead of save_context &             ;
  15. ;                     restore_context if you need to save or restore the      ;
  16. ;                     mapping context but don't want to (or have to) use a    ;
  17. ;                     handle.                                                 ;
  18. ;                                                                             ;
  19. ;           PASSED:   &source_context:                                        ;
  20. ;                        is a far pointer to the source structure of the      ;
  21. ;                        mapping context to be restored.  The application     ;
  22. ;                        must point to a structure array which contains the   ;
  23. ;                        mapping hardware state.                              ;
  24. ;                        The structure member is described here:              ;
  25. ;                                                                             ;
  26. ;                        source_context.reserved:                             ;
  27. ;                           is a character array which is reserved for use by ;
  28. ;                           the memory manager.  In this instance it contains ;
  29. ;                           the data for the mapping hardware state.          ;
  30. ;                                                                             ;
  31. ;         RETURNED:   status:                                                 ;
  32. ;                        is the status EMM returns from the call.  All other  ;
  33. ;                        returned results are valid only if the status        ;
  34. ;                        returned is zero.  Otherwise they are undefined.     ;
  35. ;                                                                             ;
  36. ; C USE CONVENTION:   unsigned int   status;                                  ;
  37. ;                     CONTEXT_STRUCT source_context;                          ;
  38. ;                                                                             ;
  39. ;                     status = set_context (&source_context);                 ;
  40. ;-----------------------------------------------------------------------------;
  41. .XLIST
  42. PAGE    60,132
  43.  
  44. IFDEF SMALL
  45.    .MODEL SMALL, C
  46. ENDIF
  47. IFDEF MEDIUM
  48.    .MODEL MEDIUM, C
  49. ENDIF
  50. IFDEF LARGE
  51.    .MODEL LARGE, C
  52. ENDIF
  53. IFDEF COMPACT
  54.    .MODEL COMPACT, C
  55. ENDIF
  56. IFDEF HUGE
  57.    .MODEL HUGE, C
  58. ENDIF
  59.  
  60. INCLUDE emmlib.equ
  61. INCLUDE emmlib.str
  62. INCLUDE emmlib.mac
  63. .LIST
  64. .CODE
  65.  
  66. set_context        PROC                                                  \
  67.             USES DS SI,                                           \
  68.             ptr_source_context:FAR PTR BYTE
  69.  
  70.     ;---------------------------------------------------------------------;
  71.     ;   do;                                                               ;
  72.     ;   .   set the current memory mapping context to EMM;                ;
  73.     ;---------------------------------------------------------------------;
  74.     MOVE        AX, set_page_map_fcn
  75.     MOVE        DS:SI, ptr_source_context
  76.     INT         EMM_int
  77.  
  78.     ;---------------------------------------------------------------------;
  79.     ;   .   return (EMM status);                                          ;
  80.     ;   end;                                                              ;
  81.     ;---------------------------------------------------------------------;
  82.     RET_EMM_STAT    AH
  83.  
  84. set_context        ENDP
  85.  
  86. END
  87.